﻿using UnityEngine;

namespace UnityX
{
    [DisallowMultipleComponent]
    [AddComponentMenu("Animation/Rotate In")]
    public class RotateIn : AnimationBehaviour
    {
        public Vector3 rotate = Vector3.zero;
        //public AnimationValueType valueType = AnimationValueType.固定;

        private Quaternion m_BeginValue;
        private Quaternion m_EndValue;

        protected override void Begin()
        {
            m_BeginValue = Quaternion.Euler(rotate);
            m_EndValue = transform.localRotation;
            transform.localRotation = m_BeginValue;
        }
        protected override void End()
        {
            transform.localRotation = m_EndValue;
        }
        protected override void Set(float t)
        {
            transform.localRotation = Quaternion.Lerp(m_BeginValue, m_EndValue, t);
        }
    }
}